﻿using System;
using System.Runtime.Serialization;

namespace DigitalQuran.IO
{
    /// <summary>
    /// Exception thrown when encounters invalid structured line while reading data file
    /// </summary>
    [Serializable]
    public class InvalidFileStructureException : Exception
    {
        /// <summary>
        /// Creates new instance
        /// </summary>
        /// <param name="line">Line number where structure is invalid</param>
        /// <param name="lineText">Text of line</param>
        /// <param name="filePath">Path of file</param>
        /// <param name="message">Additional Error Message</param>
        public InvalidFileStructureException(int line, string lineText, string filePath, string message)
            : base(message)
        {
            this.LineText = lineText;
            this.FileName = filePath;
            this.LineNo = line;            
        }

        /// <summary>
        /// Gets the line no where error encounters
        /// </summary>
        public int LineNo { get; private set; }

        /// <summary>
        /// Gets Text of error line
        /// </summary>
        public string LineText { get; private set; }
        
        /// <summary>
        /// Gets the filename having error
        /// </summary>
        public string FileName { get; private set; }

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);            
        }
    }
}